using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;

namespace MaterialUI
{
	[AddComponentMenu("MaterialUI/Easy Tween", 100)]
	public class EasyTween : MonoBehaviour, IEventSystemHandler
	{
		[Serializable]
		public class EasyTweenObject
		{
			[SerializeField]
			private string m_Tag;

			[SerializeField]
			private GameObject m_TargetGameObject;

			[SerializeField]
			private Tween.TweenType m_TweenType;

			[SerializeField]
			private AnimationCurve m_CustomCurve;

			[SerializeField]
			private float m_Duration;

			[SerializeField]
			private float m_Delay;

			[SerializeField]
			private bool m_TweenOnStart;

			[SerializeField]
			private bool m_HasCallback;

			[SerializeField]
			private GameObject m_CallbackGameObject;

			[SerializeField]
			private Component m_CallbackComponent;

			[SerializeField]
			private string m_CallbackComponentName;

			[SerializeField]
			private MethodInfo m_CallbackMethodInfo;

			[SerializeField]
			private string m_CallbackName;

			[SerializeField]
			private bool m_OptionsVisible;

			[SerializeField]
			private bool m_SubOptionsVisible;

			[SerializeField]
			private List<EasyTweenSubObject> m_SubTweens;

			public string tag
			{
				get
				{
					return m_Tag;
				}
				set
				{
					m_Tag = value;
				}
			}

			public GameObject targetGameObject
			{
				get
				{
					return m_TargetGameObject;
				}
				set
				{
					m_TargetGameObject = value;
				}
			}

			public Tween.TweenType tweenType
			{
				get
				{
					return m_TweenType;
				}
				set
				{
					m_TweenType = value;
				}
			}

			public AnimationCurve customCurve
			{
				get
				{
					return m_CustomCurve;
				}
				set
				{
					m_CustomCurve = value;
				}
			}

			public float duration
			{
				get
				{
					return m_Duration;
				}
				set
				{
					m_Duration = value;
				}
			}

			public float delay
			{
				get
				{
					return m_Delay;
				}
				set
				{
					m_Delay = value;
				}
			}

			public bool tweenOnStart
			{
				get
				{
					return m_TweenOnStart;
				}
				set
				{
					m_TweenOnStart = value;
				}
			}

			public bool hasCallback
			{
				get
				{
					return m_HasCallback;
				}
				set
				{
					m_HasCallback = value;
				}
			}

			public GameObject callbackGameObject
			{
				get
				{
					return m_CallbackGameObject;
				}
				set
				{
					m_CallbackGameObject = value;
				}
			}

			public Component callbackComponent
			{
				get
				{
					return m_CallbackComponent;
				}
				set
				{
					m_CallbackComponent = value;
				}
			}

			public string callbackComponentName
			{
				get
				{
					return m_CallbackComponentName;
				}
				set
				{
					m_CallbackComponentName = value;
				}
			}

			public MethodInfo callbackMethodInfo
			{
				get
				{
					return m_CallbackMethodInfo;
				}
				set
				{
					m_CallbackMethodInfo = value;
				}
			}

			public string callbackName
			{
				get
				{
					return m_CallbackName;
				}
				set
				{
					m_CallbackName = value;
				}
			}

			public bool optionsVisible
			{
				get
				{
					return m_OptionsVisible;
				}
				set
				{
					m_OptionsVisible = value;
				}
			}

			public bool subOptionsVisible
			{
				get
				{
					return m_SubOptionsVisible;
				}
				set
				{
					m_SubOptionsVisible = value;
				}
			}

			public List<EasyTweenSubObject> subTweens
			{
				get
				{
					return m_SubTweens;
				}
				set
				{
					m_SubTweens = value;
				}
			}

			public EasyTweenObject()
			{
				tag = "New Tween";
				tweenType = MaterialUI.Tween.TweenType.EaseOutQuint;
				duration = 1f;
				callbackComponentName = "--NONE--";
				callbackName = "--NONE--";
				optionsVisible = true;
				subOptionsVisible = true;
				customCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f));
				subTweens = new List<EasyTweenSubObject>
				{
					new EasyTweenSubObject()
				};
			}
		}

		[Serializable]
		public class EasyTweenSubObject
		{
			public Component targetComponent;

			public string targetComponentName;

			public string targetVariableName;

			public FieldInfo targetFieldInfo;

			public PropertyInfo targetPropertyInfo;

			public bool isProperty;

			public string variableType;

			public Vector4 targetValue;

			public int targetValueLength;

			public bool[] modifyParameters;

			public Material currentMaterial;

			public EasyTweenSubObject()
			{
				modifyParameters = new bool[4]
				{
					true,
					true,
					true,
					true
				};
				targetComponent = null;
				targetComponentName = "--NONE--";
				targetVariableName = "--NONE--";
				targetFieldInfo = null;
				targetPropertyInfo = null;
				isProperty = false;
				variableType = null;
				targetValueLength = 0;
				targetValue = default(Vector4);
			}
		}

		[SerializeField]
		private List<EasyTweenObject> m_Tweens;

		public List<EasyTweenObject> tweens
		{
			get
			{
				return m_Tweens;
			}
			set
			{
				m_Tweens = value;
			}
		}

		private void Start()
		{
			for (int i = 0; i < tweens.Count; i++)
			{
				if (tweens[i].tweenOnStart)
				{
					Tween(i);
				}
			}
		}

		public void TweenAll()
		{
			for (int i = 0; i < tweens.Count; i++)
			{
				TweenSet(tweens[i]);
			}
		}

		public void Tween(int index)
		{
			TweenSet(tweens[index]);
		}

		public void Tween(string tag)
		{
			for (int i = 0; i < tweens.Count; i++)
			{
				if (tweens[i].tag == tag)
				{
					TweenSet(tweens[i]);
				}
			}
		}

		private void TweenSet(EasyTweenObject tweenObject)
		{
			for (int i = 0; i < tweenObject.subTweens.Count; i++)
			{
				EasyTweenSubObject easyTweenSubObject = tweenObject.subTweens[i];
				if (!(tweenObject.callbackName != "--NONE--") || tweenObject.hasCallback)
				{
				}
				switch (easyTweenSubObject.variableType)
				{
				}
			}
		}
	}
}
